package myJs.myPkg

import scala.scalajs.js
import slinky.readwrite.ObjectOrWritten

import scala.scalajs.js.Dynamic.{global => g}
import scala.scalajs.js.annotation.{JSGlobal, JSImport, JSName}

/**
 * Created by yz on 2019/3/14
 */
@js.native
@JSImport("bootstrap-sweetalert", JSImport.Default)
object swal extends js.Object {

  def apply(options: ObjectOrWritten[SwalOptions]): Unit = js.native

  def apply(options: ObjectOrWritten[SwalOptions], f: js.Function): Unit = js.native

  def close(): Unit = js.native

}

case class SwalOptions(
                        text: js.UndefOr[String] = js.undefined,
                        title: js.UndefOr[String] = js.undefined,
                        `type`: js.UndefOr[String] = js.undefined,
                        showCancelButton: js.UndefOr[Boolean] = js.undefined,
                        showConfirmButton: js.UndefOr[Boolean] = js.undefined,
                        confirmButtonClass: js.UndefOr[String] = js.undefined,
                        confirmButtonText: js.UndefOr[String] = js.undefined,
                        closeOnConfirm: js.UndefOr[Boolean] = js.undefined,
                        cancelButtonText: js.UndefOr[String] = js.undefined,
                        cancelButtonClass: js.UndefOr[String] = js.undefined,
                        showLoaderOnConfirm: js.UndefOr[Boolean] = js.undefined,
                      )
